<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
  <head>
    <title>添加餐厅</title>
    <script type="text/javascript"
	src="/QueenRestaurantWeb/resources/js/jquery-1.10.1.js"></script>
  </head>
  
<body>
<script type="text/javascript">
$(function(){
	
});
function register_restaurant(){
	alert("click");
	var restaurant = new Object();
	restaurant.restaurantName = $("#restaurantName").val();
	restaurant.password = $("#password").val();
	restaurant.address = $("#address").val();
	restaurant.phone = $("#phone").val();
	restaurant.introduce = $("#introduce").val();
	restaurant.type = $("#type").val();
	restaurant.latitude = $("#latitude").val();
	restaurant.longitude = $("#longitude").val();
	
	alert(JSON.stringify(restaurant));
	
	$.ajax({
		type:'POST',
		contentType:'application/json',
		url:"/QueenRestaurantWeb/restaurant/register",
		data:JSON.stringify(restaurant),
		success: function (data){
			alert("success");
			location.href="/QueenRestaurantWeb/" + data;
		},
		error:function(){
			alert("error");
		}
	});
}

</script>
	<table>
		<tr>
			<td>餐厅名称：</td>
			<td><input type="text" id="restaurantName"/></td>
		</tr>
		<tr>
			<td>密 码：</td>
			<td><input type="text" id="password"/></td>
		</tr>
		<tr>
			<td>餐厅地址：</td>
			<td><input type="text" id="address"/></td>
		</tr>
		<tr>
			<td>餐厅电话 ：</td>
			<td><input type="text" id="phone"/></td>
		</tr>
		<tr>
			<td>餐厅简介：</td>
			<td><input type="text" id="introduce"/></td>
		</tr>
		<tr>
			<td>餐厅类型 ：</td>
			<td><input type="text" id="type"/></td>
		</tr>
		<tr>
			<td>经度：</td>
			<td><input type="text" id="longitude"/></td>
		</tr>
		<tr>
			<td>纬度 ：</td>
			<td><input type="text" id="latitude"/></td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<input id="register_bn" type="button" value="提交" name="register_bn" onclick="register_restaurant()"/>
			</td>
		</tr>
	</table>
  </body>
</html>
